package com.mzplayer.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.SeekBar;

/**
 * @Package: com.mzplayer.widget
 * @ClassName: BanSeekBar
 * @Description: java类作用描述
 * @Author: 麦子
 * @QQ: 3332174009
 * @CreateDate: 2021/7/23 13:08
 */
public class BanSeekBar extends SeekBar {

    private boolean touch = true;

    public BanSeekBar(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public BanSeekBar(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setTouch(boolean touch) {
        this.touch = touch;
    }

    public boolean canTouch() {
        return touch;
    }

    @SuppressLint("ClickableViewAccessibility")
    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if (touch) {
            return super.onTouchEvent(event);
        }
        return false;
    }
}